import { FormGroup } from '@angular/forms';
import { Component, OnInit, Input } from '@angular/core';

@Component({
  selector: 'm-restricted-app-form',
  templateUrl: './restricted-app-form.component.html',
  styleUrls: ['./restricted-app-form.component.scss']
})
export class RestrictedAppFormComponent implements OnInit {

  @Input() restrictedForm: FormGroup;

  limit_software_hidden: boolean = true;
  rstrHeadText: string;

  constructor() { }

  ngOnInit() {
    console.log('restrictedForm', this.restrictedForm.disabled);

    this.restrictedForm.controls.limit_policy.valueChanges.subscribe(value => {
      this.limit_software_hidden = Boolean(value);
      switch (value) {
        case 1:
          this.rstrHeadText = '白名单'
          break;
        case 2:
          this.rstrHeadText = '黑名单'
          break;
      }
    })
  }

}
